package com.qiaofei.controller.api;

import com.qiaofei.pojo.Result;
import com.qiaofei.service.impl.BaseServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/api")
public class BaseController {

    @Qualifier("baseServiceImpl")
    @Autowired
    private BaseServiceImpl baseService;

    @GetMapping("/dashboard")
    public Result dashboard(){
        return Result.success();
    }

    @DeleteMapping("/deleteImages")
    public Result deleteImages(@RequestBody Map<String, Object> imagesList){
        log.info("删除图片操作, imagesList:{}",imagesList.toString());
        List<String> filelist = (List<String>) imagesList.get("imagesList");
        baseService.deleteImages(filelist);
        return Result.success();
    }
}
